package com.aaa.service.impl;

import com.aaa.dao.Question_fpaDao;

import com.aaa.entity.Question_fpa;
import com.aaa.service.Question_fpaService;

import com.aaa.util.Enum01;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;



@Service
public class Qusertion_fpaServiceImpl implements Question_fpaService {

    @Autowired
    private Question_fpaDao question_fpaDao;

    /**
    * @Author: WTH
    * @Description: 查询
    * @Date:2022-06-29 14:41
    * @Params:
    */
    @Override
    public Page<Question_fpa> selectQuestion_fpa(Question_fpa question) {
        Page<Question_fpa> page= PageHelper.startPage(question.getPage(),question.getLimit());
        List<Question_fpa> question_fpas = question_fpaDao.selectQuestion(question);
        Page quesPage= (Page) question_fpas;
        return quesPage;
    }

    /**
    * @Author: WTH
    * @Description: 新增
    * @Date:2022-06-29 17:01
    * @Params:
    */
    @Override
    public Enum01 insertQuestion(Question_fpa question) {
        int i = question_fpaDao.addQuestion(question);
        if(i>0){
            return Enum01.SUCCESS;
        }else{
            return Enum01.FAIL;
        }
    }

    /**
    * @Author: WTH
    * @Description: 修改
    * @Date:2022-06-29 20:07
    * @Params:
    */
    @Override
    public int updateQuestion(Question_fpa question) {
        int i = question_fpaDao.updateQuestion(question);
        return i;
    }

    /**
    * @Author: WTH
    * @Description: 删除
    * @Date:2022-06-29 20:33
    * @Params:
    */
    @Override
    public boolean deleteQuestion(String id) {
        int i = question_fpaDao.deleteQuestion(id);
        if(i>0){
            return true;
        }
        return false;
    }




    @Override
    public List<Question_fpa> questionAllfpa() {
        return question_fpaDao.questionAllfpa();
    }
}
